Solving 10385 - Duathlon (Ternary search)
[and.git] / 10005 - Packing polygons / 10005.cpp
blob62c95ada8a33dbdbad35866861d6fc79be8f8dad
1 #include <iostream>
2 #include <cmath>
4 using namespace std;
6 struct point{
7 int x, y;
8 };
10 int main(){
11 int n;
12 while (cin >> n && n){
13 point p[n];
14 for (int i=0; i<n; ++i){
15 cin >> p[i].x >> p[i].y;
17 double r;
18 cin >> r;
20 double longest = 0.0;
21 for (int i=0; i<n; ++i){
22 for (int j=i+1; j<n; ++j){
23 longest = max(longest, hypot(p[i].x - p[j].x, p[i].y - p[j].y));
26 if (longest < 2*r){
27 cout << "The polygon can be packed in the circle." << endl;
28 }else{
29 cout << "There is no way of packing that polygon." << endl;
32 return 0;